<!DOCTYPE html>

<!--[if IE 8]> <html lang="zh" class="ie8 no-js"> <![endif]-->

<!--[if IE 9]> <html lang="zh" class="ie9 no-js"> <![endif]-->

<!--[if !IE]><!--> <html lang="zh" class="no-js"> <!--<![endif]-->

<head>

    <script src="/at/media/js/jquery-1.10.1.min.js" type="text/javascript"></script>
    <script src="/at/media/js/app.js" type="text/javascript"></script>

    <meta charset="utf-8" />

    @if ( Auth::guard('admin')->check() )
        <title>满天星一体机后台管理系统</title>
        @endif


    @if ( Auth::guard('customer')->check() )

        @if( Auth::guard('customer')->user()->ownsTypes( [ \App\Services\BymAdmin\PurchaseType::WEMALL ] ) && ! Auth::guard('customer')->user()->ownsAIGM() )
            <title>微商城管理系统</title>
        @else
            <title>满天星一体机后台管理系统</title>
        @endif

    @endif

    {{--{{ dd(Auth::guard('store')->user()->store->customer->customerAdmin[0]->ownsAIGM()) }}--}}
    @if ( Auth::guard('store')->check() )
        @if( Auth::guard('store')->user()->store->customer->customerAdmin[0]->ownsTypes( [ \App\Services\BymAdmin\PurchaseType::WEMALL ]) && ! Auth::guard('store')->user()->store->customer->customerAdmin[0]->ownsAIGM() )
            <title>微商城管理系统</title>
        @else
            <title>满天星一体机后台管理系统</title>
        @endif
    @endif



    <meta content="width=device-width, initial-scale=1.0" name="viewport" />

    <meta content="" name="description" />

    <meta content="" name="author" />

    <!-- BEGIN GLOBAL MANDATORY STYLES -->

    <link href="/at/media/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>

    <link href="/at/media/css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css"/>

    <link href="/at/media/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>

    <link href="/at/media/css/style-metro.css" rel="stylesheet" type="text/css"/>

    <link href="/at/media/css/style.css" rel="stylesheet" type="text/css"/>

    <link href="/at/media/css/style-responsive.css" rel="stylesheet" type="text/css"/>

    <link href="/at/media/css/default.css" rel="stylesheet" type="text/css" id="style_color"/>

    <link href="/at/media/css/uniform.default.css" rel="stylesheet" type="text/css"/>

    <!-- 引入样式 -->
    {{--<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-default/index.css">--}}
    {{--<link rel="stylesheet" href="/css/element.css">--}}
    <!-- 引入组件库 -->

    <!-- END GLOBAL MANDATORY STYLES -->

    <!-- BEGIN PAGE LEVEL STYLES -->

    @yield('pluginStyle')

    {{-- Data Table css ：可筛选table  --}}
    <link rel="stylesheet" href="/at/media/css/DT_bootstrap.css" />
    {{-- End Data Table css --}}

    <!-- END PAGE LEVEL STYLES -->

    <link rel="shortcut icon" href="/at/media/image/favicon.ico" />

    <style>
        *:not(i) {
            font-family: 'Microsoft YaHei UI', '微软雅黑', 'Arial' , 'HeiTi SC' ,sans-serif !important;
        }

        /* for header nav bar title BEGIN*/
         .header-brand {
             color: white;
             float: left;
         }
        .header-brand:hover {
            color: grey;
            text-decoration: none;
        }
        /* for header nav bar title END*/
        
        [v-cloak]{
            display: none;
        }

    </style>

</head>

<!-- END HEAD -->

<!-- BEGIN BODY -->

<body class="page-header-fixed page-footer-fixed" id="v_app">

<!-- BEGIN HEADER -->

@include('admin.owns.header')

<!-- END HEADER -->

<!-- BEGIN CONTAINER -->

<style>

    #model_msg {
        width: 650px;
        margin-left: -300px;
    }

</style>
{{-- Model Begin --}}

<div id="model_msg" class="modal hide fade" tabindex="-1" data-focus-on="input:first">

    <div class="modal-header">

        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>

        <h3>消息详情</h3>

    </div>


    <div class="modal-body">

        <form action="" class="form-horizontal" method="post" id="msg-form">
            {{ method_field('PATCH') }}
            {{ csrf_field() }}

            <div class="row-fluid">
                <div class="col-xs-6">
                    <address>
                        接收时间  <strong><span class="m-time"></span></strong>
                        <br>
                    </address>
                </div>
                <hr>
                <div class="col-xs-6">
                    <address>
                        <strong>消息详情:</strong><br>
                        <div class="m-msg" style="word-break:break-all"></div>
                    </address>
                </div>
            </div>

            <!--/row-->

        </form>


    </div>

</div>

<div id="modify-info" class="modal hide fade" tabindex="-1" data-focus-on="input:first">

    <div class="modal-header">

        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>

        <h3>密码修改</h3>

    </div>


    <div class="modal-body">

        <form action="" class="form-horizontal" method="post" id="pwd-form">
            {{ csrf_field() }}
            <div class="row-fluid">
            <div class="control-group">
                <label class="control-label">登录账号</label>

                <div class="controls">

                    <input type="text" class="m-wrap span9" placeholder="登录账号" name="email" readonly>

                </div>

            </div>

            {{--<div class="control-group">--}}
                {{--<label class="control-label">姓名</label>--}}

                {{--<div class="controls">--}}

                    {{--<input type="text" class="m-wrap span9" placeholder="姓名" name="name">--}}

                {{--</div>--}}

            {{--</div>--}}

            <div class="control-group">
                <label class="control-label">新密码</label>

                <div class="controls">

                    <input type="password" class="m-wrap span9" onkeyup="this.value=this.value.replace(/^ +| +$/g,'')" placeholder="新密码,不少于6位" name="password">

                </div>

            </div>

            <div class="control-group">
                <label class="control-label">确认密码</label>

                <div class="controls">

                    <input type="password" class="m-wrap span9" onkeyup="this.value=this.value.replace(/^ +| +$/g,'')" placeholder="确认密码" name="confirm_pwd">

                </div>

            </div>
                <div class="form-actions">

                    <button type="button" class="btn blue change-pwd" ><i class="icon-ok"></i> 确认修改</button>

                    {{--<button type="reset" class="btn" style="float: right">清空</button>--}}

                </div>
            </div>

            <!--/row-->

        </form>


    </div>

</div>

<div class="page-container" style="min-width: 1600px">

    <!-- BEGIN SIDEBAR -->

    <div class="page-sidebar nav-collapse collapse">

        <!-- BEGIN SIDEBAR MENU -->

        <ul class="page-sidebar-menu" id="sidebar_menu">

            <li>

                <!-- BEGIN SIDEBAR TOGGLER BUTTON -->

                <div class="sidebar-toggler hidden-phone" style="margin-bottom: 20px"></div>

                <!-- BEGIN SIDEBAR TOGGLER BUTTON -->

            </li>

            @if ( Auth::guard('admin')->check() )
                @include('admin.owns.benyamin')
            @endif

            @if ( Auth::guard('customer')->check() )
                @if ( Auth::guard('customer')->user()->isVirtualProvider() )
                    @include('admin.owns.customer-provider')
                @else
                    @include('admin.owns.customer')
                @endif
            @endif

            @if ( Auth::guard('store')->check() )
                @include('admin.owns.store')
            @endif


        </ul>

        <!-- END SIDEBAR MENU -->

    </div>

    <!-- END SIDEBAR -->

{{-- 主要内容 --}}

<!-- BEGIN PAGE -->

    <div class="page-content">

        <div id="portlet-config" class="modal hide">

            <div class="modal-header">

                <button data-dismiss="modal" class="close" type="button"></button>

                <h3>插件？</h3>

            </div>

            <div class="modal-body">

                Widget settings form goes here

            </div>

        </div>

        <!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->

        @yield('pageContainer')

    </div>

    <!-- END PAGE -->

</div>

<!-- END CONTAINER -->

<!-- BEGIN FOOTER -->

<div class="footer">

    <div class="footer-inner">

        2016-{{ date('Y') }} &copy; 便雅悯. Powered by Panxsoft

    </div>

    <div class="footer-tools">

			<span class="go-top">

			<i class="icon-angle-up"></i>

			</span>

    </div>

</div>

<!-- END FOOTER -->

<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->

<!-- BEGIN CORE PLUGINS -->

{{--<script src="/at/media/js/jquery-1.10.1.min.js" type="text/javascript"></script>--}}

<script src="/at/media/js/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>

<!-- IMPORTANT! Load jquery-ui-1.10.1.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->

<script src="/at/media/js/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script>

<script src="/at/media/js/bootstrap.min.js" type="text/javascript"></script>

<!--[if lt IE 9]>

<script src="/at/media/js/excanvas.min.js"></script>

<script src="/at/media/js/respond.min.js"></script>

<![endif]-->

<script src="/at/media/js/jquery.slimscroll.min.js" type="text/javascript"></script>

<script src="/at/media/js/jquery.blockui.min.js" type="text/javascript"></script>

<script src="/at/media/js/jquery.cookie.min.js" type="text/javascript"></script>

<script src="/at/media/js/jquery.uniform.min.js" type="text/javascript" ></script>
<script src="/at/media/js/button-submit-able.js"></script>

<!-- END CORE PLUGINS -->

{{-- Data Table JS : 加载顺序不能反 --}}
<script type="text/javascript" src="/at/media/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/at/media/js/DT_bootstrap.js"></script>
{{-- End Data Table JS --}}

{{--引入vue--}}
<script src="/js/vue-2.0.js"></script>
<script src="/at/libs/vue-resource.min.js"></script>

{{--引入封装好的请求方法--}}
<script src="/at/request/Request_Method.js"></script>
{{--引入api请求的地址--}}
<script src="/at/api/API_LIST.js"></script>
{{--引入订单提醒--}}
<script src="/at/order/order-remind.js"></script>

@yield('pluginScript')


<!-- BEGIN PAGE LEVEL SCRIPTS -->

<script src="/at/media/js/app.js" type="text/javascript"></script>

<script src="/at/media/js/index.js" type="text/javascript"></script>

@yield('pageScript')

<!-- END PAGE LEVEL SCRIPTS -->


<script>

    jQuery(document).ready(function() {

        App.init(); // initlayout and core plugins

        @yield('pluginInit')

    });

</script>

<script>
    $(function(){
        $('.dataTable').delegate('.del-line','click',function () {
            return confirm("确定删除？");
        });
    });
</script>

<script>

    $(function(){
//        alert($("#hidden").find('ul').find("li").find('a').length);
        if ( $("#hidden").find('ul').find("li").find('a').length == 0 )
        {
            $("#hidden").hide();
        }
    });

</script>

<script>
    $(function () {

        function addLoading() {
            if (App) {
                App.blockUI($('#msg-form'));
                $('#model_msg .blockElement').css({"left":"40%","top":"40%","position":"absolute"});
//                    if ($('.modal')) App.blockUI($('.modal'));

            } else {
                console.log('Please use after App.js initialized')
            }
        }

        function addLoading2() {
            if (App) {
                App.blockUI($('#pwd-form'));
                $('#modify-info .blockElement').css({"left":"40%","top":"40%","position":"absolute"});
//                    if ($('.modal')) App.blockUI($('.modal'));

            } else {
                console.log('Please use after App.js initialized')
            }
        }

        // 查看消息

        $('.view-msg').click(function(){

            addLoading();

            $.ajax({
                method: "GET",
                url: $(this)[0].dataset.href,
            }).done(function(data){
//                    console.log(data);

                $('.m-time').html(data.created_at);
                $('.m-msg').html(data.message);

                if (App) {

                    App.unblockUI($('#msg-form'));

                } else {
                    console.log('Please use after App.js initialized');
                }
            }).fail(function(){
                console.log('Failed get temple data');
                if (App) {

                    App.unblockUI($('#msg-form'));

                } else {
                    console.log('Please use after App.js initialized')
                }
            })
        });

        $('.personal-info').click(function(){

            addLoading2();

            $.ajax({
                method: "GET",
                url: $(this).attr('data-href')+'/'+$(this).attr('data-id'),
            }).done(function(data){
//                    console.log(data);

                $('input[name=email]').val(data.email);
                $('input[name=name]').val(data.name);

                if (App) {

                    App.unblockUI($('#pwd-form'));

                } else {
                    console.log('Please use after App.js initialized');
                }
            }).fail(function(){
                console.log('Failed get temple data');
                if (App) {

                    App.unblockUI($('#pwd-form'));

                } else {
                    console.log('Please use after App.js initialized')
                }
            })
        });

    });
</script>

<script>

    $('.change-pwd').click(function(){

        if ( $.trim( $('input[name=password]').val().length ) < 6 )
        {
            alert('密码不少于6位');
            return false;
        }

        if ( $.trim( $('input[name=confirm_pwd]').val()) != $.trim( $('input[name=password]').val() )   )
        {
            alert('新密码与确认密码不一致');
            return false;
        }

        $.ajax({
            method: "post",
            url: $('.personal-info').attr('data-href'),
            data : {
                '_token' : "{{ csrf_token() }}",
                'name' :  $('input[name=name]').val(),
                'password' : $('input[name=password]').val(),
                'id' : $('.personal-info').attr('data-id')
            }
        })
            .done(function(data){
                if ( data.status=='success' )
                {
                    alert('修改成功，请重新登录');
                    window.location.href=data.url;
                }else{
                    alert('修改失败，请重试');
                    return false;
                }
        })
            .fail(function(){
            alert('error');
        })
    });


</script>

<script>

    var CustomerResource = new Resource( API_LIST.TRANSFER_TYPE , Vue.http );

    !function customerType(){

        var vm = new Vue({

            el : '#sidebar_menu',

            data : {

                customer_type : null   //判断登录进来的是什么类型的客户

            },

            created : function(){

                this.initCustomerType();

            },

            methods : {
                //请求初始数据
                initCustomerType : function initCustomerType(){

                    var self = this;

                    CustomerResource.index()
                                    .then(function (res) {

                                        if (parseInt(res.data.code) === 0) {

                                            self.customer_type = res.data.customer_type;

                                            sessionStorage.setItem( 'login_customer_type', res.data.customer_type );

                                        } else {

                                            alert(res.data.error);

                                        }

                                    })
                                    .catch(function (err) {

                                        console.log(err);

                                        alert('请求API失败！');

                                    })

                }

            }

        })

    }();

</script>


<!-- END JAVASCRIPTS -->

</body>

<!-- END BODY -->

</html>